package translinkApp.DialogBoxes.SaveJourney;

import translinkApp.views.dialog.LachDialogData;
import android.os.Parcel;
import android.os.Parcelable;

public class SaveJourneyDialogData extends LachDialogData {
	private boolean fromLocation;
	private boolean toLocation;
	private boolean leaveType;
	private boolean transportType;
	private boolean date;
	private boolean time;
	private String name;

	public String getName() {
		return name;
	}

	public static Parcelable.Creator getCreator() {
		return CREATOR;
	}

	public boolean isFromLocation() {
		return fromLocation;
	}

	public boolean isToLocation() {
		return toLocation;
	}

	public boolean isLeaveType() {
		return leaveType;
	}

	public boolean isTransportType() {
		return transportType;
	}

	public boolean isDate() {
		return date;
	}

	public boolean isTime() {
		return time;
	}

	public SaveJourneyDialogData(boolean fromLocation, boolean toLocation, boolean leaveType,
			boolean transportType, boolean date, boolean time, String name) {
		this.fromLocation = fromLocation;
		this.toLocation = toLocation;
		this.leaveType = leaveType;
		this.transportType = transportType;
		this.date = date;
		this.time = time;
		this.name = name;
	}

	// ---- Parcellable object methods

	public SaveJourneyDialogData(Parcel in) {
		this(rBool(in),rBool(in),rBool(in),rBool(in),rBool(in),rBool(in), in.readString());
	}
	
	private static boolean rBool(Parcel in)
	{
		return (Boolean) in.readValue(Boolean.class.getClassLoader());
	}

	public static final Parcelable.Creator CREATOR = new Parcelable.Creator() {
		public SaveJourneyDialogData createFromParcel(Parcel in) {
			return new SaveJourneyDialogData(in);
		}

		public SaveJourneyDialogData[] newArray(int size) {
			return new SaveJourneyDialogData[size];
		}
	};

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeValue(isFromLocation());
		dest.writeValue(isToLocation());
		dest.writeValue(isLeaveType());
		dest.writeValue(isTransportType());
		dest.writeValue(isDate());
		dest.writeValue(isTime());
		dest.writeValue(getName());
	}


	@Override
	public int describeContents() {

		return 0;
	}
}
